

const {promisify} = require('util'); // 用来将回调封装呈promise
const figlet = promisify(require('figlet'));
const clear = require('clear');
const chalk = require('chalk');
const {clone} = require('./download');

const log = content => {

    console.log(chalk.red(content));
}




module.exports = async (name) => {

    // 清空终端的内容
    clear();
    // 这里使用 await,因为这里花费时间
    const data = await figlet('Welcome to hotpot-cli');
    // 打印欢迎界面
    log(data);
 
    // 下载项目模板
    log('创建项目:' + name);
    await clone('github:su37josephxia/vue-template',name);
};

